#include "processbar.h"


void download(callback_t cb)
{
  srand(time(0)^1024);
  int total = FILESIZE;
  while(total)
  {
    usleep(10000);
    //消耗的
    int one = rand() % (1024*1024*10);
    total -= one;

    if(total < 0)
      total = 0;

    double download = FILESIZE - total;
    double rate = (download*1.0/(FILESIZE))*100.0; // 百分之几
    cb(rate);
  }

}


int main()
{
  //process();  
  download(process_flush);

  return 0;
}


